<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common.jsp"%>
<html>
<head>
</head>
<body>
<style>
        body{
            background-image:url("${pageContext.request.contextPath}/static/qq.png");
            background-repeat: no-repeat;
            background-size: 100%;
        }
</style>
<div id="show" style="width: 100%;height: 60% ">
    <span id="bb">SCL测试人数</span><span></span>
    <div style="width: 50%;height: 350px;color: pink; margin: auto;" id="shopping"></div>
    <div style="width: 100%;height: 350px;color: pink; margin: auto;" id="shop"></div>
    <div style="width: 100%;margin: auto;" id="explain"></div>
</div>
</body>
<script>
    layui.config({
    })
    layui.use(['form', 'layer', 'jquery'], function() {
        var layer = layui.layer;
        var $ = layui.jquery;
        $.ajax({
            url: "${pageContext.request.contextPath}/sclLastController/queryAll.do"
            //响应的数据类型
            , dataType: "JSON"
            , type: "POST"
            //异步请求
            // async: true,
            //成功的回调
            , success: function (data) {
                if (data.code == 0) {
                    var somatization = data.data.somatization,
                        compel=data.data.compel,
                        interpersonal=data.data.interpersonal,
                        depressed =data.data.depressed,
                        anxiety = data.data.anxiety,
                        hostile = data.data.hostile,
                        terror = data.data.terror,
                        bigoted = data.data.bigoted,
                        psychotic = data.data.psychotic,
                        sleepAndDiet = data.data.sleepAndDiet,
                        total = data.data.total
                    $("#bb").next().html(total);
                    var myChart = echarts.init(document.getElementById('shopping'));
                    var option;
                    option= {
                        color: ['dark', 'green'],
                        title: {
                            text: 'SCL心理测试'
                        },
                        legend: {
                            data: ['不合格', '总人数']
                        },
                        radar: {
                            indicator: [
                                {name: '躯体化', max: total},
                                {name: '强迫', max: total},
                                {name: '人际敏感', max: total},
                                {name: '抑郁', max: total},
                                {name: '焦虑', max: total},
                                {name: '敌对', max: total},
                                {name: '恐怖', max: total},
                                {name: '偏执', max: total},
                                {name: '精神病', max: total},
                                {name: '睡眠及饮食', max: total}
                            ],
                            center: ['50%', '50%'],
                            radius: 120,
                            axisName: {
                                color: '#fff',
                                backgroundColor: '#666',
                                borderRadius: 3,
                                padding: [3, 5]
                            }
                        },
                        series: [


                            {
                                name: 'Budget vs spending',
                                type: 'radar',//雷达图类型
                                data: [
                                    {
                                        value: [somatization,compel, interpersonal, depressed, anxiety, hostile, terror, bigoted,psychotic,sleepAndDiet],
                                        name: '不合格',
                                        lineStyle: {
                                            type: 'dashed'
                                        },

                                        label: {
                                            show: true,
                                            formatter: function (params) {
                                                return params.value;
                                            }
                                        }
                                    },
                                    {
                                        value: [total, total, total, total, total, total, total, total, total,total],
                                        name: '总人数',
                                        label: {
                                            show: true,
                                            formatter: function (params) {
                                                return params.value;
                                            }
                                        }
                                    }
                                ]
                            }
                        ]
                    };
                    myChart.setOption(option);

                    var myChart = echarts.init(document.getElementById('shop'));
                    var optio = {

                        xAxis: {
                            type: 'category',
                            data: ['躯体化', '强迫','人际敏感', '抑郁', '焦虑', '敌对', '恐怖', '偏执','精神病','睡眠及饮食'],
                            center: ['100%', '50%']
                        },
                        yAxis: {
                            type: 'value'

                        },
                        series: [
                            {
                                data: [somatization,compel, interpersonal, depressed, anxiety, hostile, terror, bigoted,psychotic,sleepAndDiet],
                                type: 'line',
                                smooth: true
                            }
                        ],
                    }
                    myChart.setOption(optio);
                }
                layer.msg(data.msg);
            }
        });
    });

</script>
</html>
